/**
 *    @file       listentask.h
 *
 *    @brief      
 *    @details
 *
 *    @version    1.0
 *    @date       02/19/2014 04:25:52 PM
 *
 *    @author     Theophilus (), wangtf418@gmail.com
 */
#ifndef _SF_LISTENTASK_H_
#define _SF_LISTENTASK_H_
#include "sockettask.h"

class listentask : public sockettask
{
public:
	listentask(csocket *sock, netprocessthread *netthread, const comargs *args = NULL);
	virtual ~listentask();

public:
	virtual bf_int_t init(bf_time_t timeout = SOCKTASK_TIMEOUT, bf_int_t sock_buflen = 102400);

public:
	virtual bf_int_t proc_msg(message *msg);
	virtual bf_int_t process_io_event(bf_int_t events);

protected:
	virtual bf_int_t recv_process();
	virtual bf_int_t send_process();
	virtual bf_int_t process_recv_packet(bf_char_t *buf, bf_size_t buflen);

protected:
	bf_int_t m_accepted_socket;
	struct sockaddr_in m_addr;
	bf_uint_t m_max_fd_size;
};

#endif

